package st.business.tepth.business.user.busnumber.workholder.maintain.work.content;

import java.util.ArrayList;
import java.util.List;

import st.business.tepth.business.bean.CommonBean;
import st.business.tepth.business.bean.MaintainNotCompleteBean;
import st.business.tepth.business.bean.MaintainNotWorkWrapper;

/**
 * @author zhangyu
 * @date 2019/5/17
 */
public class MaintainWorkDataConvert {
    public List<MaintainNotWorkWrapper> convert(MaintainNotCompleteBean bean) {
        List<MaintainNotWorkWrapper> workWrappers = new ArrayList<>();
        List<CommonBean> workList = bean.getWorkList();
        List<CommonBean> reasonList = bean.getReasonList();
        if (workList != null && reasonList != null) {
            for (CommonBean commonBean : workList) {
                MaintainNotWorkWrapper workWrapper = new MaintainNotWorkWrapper();
                workWrapper.setId(commonBean.getId());
                workWrapper.setName(commonBean.getName());
                if (!reasonList.isEmpty()) {
                    workWrapper.setResonList(reasonList);
                }
                workWrappers.add(workWrapper);
            }
        }
        return workWrappers;
    }
}
